package com.leyou.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户表
 * 
 * @author Daifeng
 * @email 2661184062@qq.com
 * @date 2020-12-25 16:44:45
 */
@Data
@TableName("tb_user")
public class UserEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@TableId(type = IdType.AUTO)
	private Long id;
	/**
	 * 用户名
	 */
	@NotEmpty(message = "用户名不能为空")
	@Length(min = 4,max = 18,message = "用户名必须为4-18字符")
	private String username;
	/**
	 * 密码，加密存储
	 */
	@NotEmpty(message = "密码不能为空")
	@Length(min = 6,max = 18,message = "密码必须为6-18字符")
	private String password;
	/**
	 * 注册手机号
	 */
	@NotEmpty(message = "手机号必须填写")
	@Pattern(regexp = "^1[35678]\\d{9}$",message = "手机号格式不正确")
	private String phone;
	/**
	 * 创建时间
	 */
	private Date created;
	/**
	 * 密码加密的salt值
	 */
	private String salt;

	/**
	 * 验证码
	 */
	@NotEmpty(message = "验证码不能为空")
	@TableField(exist = false)  //查询时  不查询这个属性
	private String code;

}
